//package com.inspur.edp.cef.generator.coreGenerator.base.entitygen.resourceinfo;
//
//
//import com.inspur.edp.caf.generator.baseInfo.ParameterInfo;
//import com.inspur.edp.caf.generator.baseInfo.TypeInfo;
//import com.inspur.edp.caf.generator.method.ClassMethodGenerator;
//import com.inspur.edp.cef.core.i18n.I18nResourceUtil;
//import com.inspur.edp.cef.rtgenerator.repositorygen.RepositoryGenUtil;
//import com.inspur.edp.cef.rtgenerator.utils.I18nGenUtil;
//import java.util.ArrayList;
//import org.eclipse.jdt.core.dom.AST;
//import org.eclipse.jdt.core.dom.Block;
//import org.eclipse.jdt.core.dom.Modifier;
//import org.eclipse.jdt.core.dom.ReturnStatement;
//import org.eclipse.jdt.core.dom.Statement;
//import org.eclipse.jdt.core.dom.StringLiteral;
//import org.eclipse.jdt.core.dom.SwitchCase;
//import org.eclipse.jdt.core.dom.SwitchStatement;
//
//public class GetUniqueConMessageMethodGen extends ClassMethodGenerator {
//
//  private static final String FormalParName_uniqueConCode = "uniqueConCode";
//  private EntityResInfoGenCtx ParentContext;
//
//  public GetUniqueConMessageMethodGen(EntityResInfoGenCtx parentContext) {
//    this.ParentContext = parentContext;
//
//  }
//
//  @Override
//  protected boolean getIsOverride() {
//    return true;
//  }
//
//  @Override
//  protected String getMethodName() {
//    return "getUniqueConstraintMessage";
//  }
//
//  @Override
//  protected TypeInfo getReturnType() {
//    return new TypeInfo(String.class);
//  }
//
//  @Override
//  protected ArrayList<Modifier.ModifierKeyword> getAccessModifiers() {
//    return RepositoryGenUtil.createModifierKeywordArray(Modifier.ModifierKeyword.PUBLIC_KEYWORD);
//  }
//
//  @Override
//  protected ArrayList<ParameterInfo> getParameterCollection() {
//    return new ArrayList<ParameterInfo>(java.util.Arrays.asList(new ParameterInfo[]{
//        RepositoryGenUtil.createParameterInfo(String.class, FormalParName_uniqueConCode),
//    }));
//  }
//
//  //        方法-唯一性约束信息显示值
////		public override string GetUniqueConstraintMessage(string uniqueConCode)
////		{
////			switch (uniqueConCode)
////			{
////                //枚举
////				case "key1":
////					return "value1";
////				default:
////					throw new Exception($"无效属性名{uniqueConCode}");
////			}
////		}
//  @Override
//  protected Block buildMethodBody() {
//    SwitchStatement switchStatement = ast.newSwitchStatement();
//    switchStatement.setExpression(ast.newSimpleName(FormalParName_uniqueConCode));
//
//    ParentContext.getEntityInfo().getUniqueConstraintInfoTypes().entrySet().stream()
//        .forEach(item -> {
//          switchStatement.statements().addAll(createReturnStatement(ast, item.getKey()));
//
//        });
//    /**
//     throw new RuntimeException("XXXXXX"+propName);
//     */
//    I18nGenUtil.getDefaultSection(ast, switchStatement, "无效的唯一性约束编码", FormalParName_uniqueConCode);
//    Block block = ast.newBlock();
//    block.statements().add(switchStatement);
//    return block;
//  }
//
//  /**
//   * case enumKey: return new XXXInfo();
//   *
//   * @return
//   */
//  private ArrayList<Statement> createReturnStatement(AST ast, String enumKey) {
//    ArrayList<Statement> list = new ArrayList<>();
//    list.add(createCaseStatement(enumKey));
//    String resourceKey = ParentContext.getUniqueConInfos().get(enumKey).getDisplayValueKey();
//    ReturnStatement returnStatement = ParentContext.
//        getParentContext().
//        getProjContext().
//        getModelResInfoGenContex().
//        BuildgetResourceItemValueReturn(ast, resourceKey);
//    list.add(returnStatement);
//    addImport(I18nResourceUtil.class.getTypeName());
//    return list;
//  }
//
//  /**
//   * @param enumKey
//   * @return case "propNameXX":
//   */
//  private Statement createCaseStatement(String enumKey) {
//    SwitchCase switchCase1 = ast.newSwitchCase();
//    StringLiteral stringLiteral = ast.newStringLiteral();
//    stringLiteral.setLiteralValue(enumKey);
//    switchCase1.setExpression(stringLiteral);
//    return switchCase1;
//  }
//
////
////			case "propName01":
////				return I18nResourceUtil.GetResourceItemValue(key);
////
////	private SwitchSectionSyntax WriteUniqueConReturnStatement(String uniqueConCode)
////	{
////		return SyntaxFactory.SwitchSection().WithLabels(SyntaxFactory.<SwitchLabelSyntax>SingletonList(SyntaxFactory.CaseSwitchLabel(SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, SyntaxFactory.Literal(uniqueConCode))))).WithStatements(SyntaxFactory.SingletonList(BuildUniqueConReturn(uniqueConCode)));
////	}
//
////
////		 *return I18nResourceUtil.GetResourceItemValue(key);
////
////	private StatementSyntax BuildUniqueConReturn(String key)
////	{
////		String resourceKey = ParentContext.getUniqueConInfos().get(key).getDisplayValueKey();
////		return ParentContext.getParentContext().getProjContext().getModelResInfoGenContex().BuildGetResourceItemValueReturn(resourceKey);
////	}
//
//}